//-------------------------------------------------------------------
//	Copyright (c) 2010-2012 Zhirnov Andrey
//	This file is part of the "UXGEN" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#ifndef _UX_TEXTURES_H
#define _UX_TEXTURES_H

#include "../CResource.h"

namespace Engine
{
namespace Resources
{
	
	//
	// Texture
	//

	class _EXPORT_ CTexture : public GLTexture, public CResource
	{
	public:
		virtual void				Destroy()			{ return GLTexture::Destroy(); }
		virtual bool				IsValid()	const	{ return _uID != 0; }
	};



	//
	// Texture 2D
	//

	class _EXPORT_ CTexture2D : public GLTexture2D, public CResource
	{
	public:
		virtual bool				SwapData(const IResourcePtr &);
		virtual void				Destroy()			{ return GLTexture2D::Destroy(); }
		virtual bool				IsValid()	const	{ return _uID != 0; }
		virtual e_resource::type	GetType()	const	{ return e_resource::TEXTURE_2D; }
	};



	//
	// Texture 2D Array
	//

	class _EXPORT_ CTexture2DArray : public GLTexture2DArray, public CResource
	{
	public:
		virtual bool				SwapData(const IResourcePtr &);
		virtual void				Destroy()			{ return GLTexture2DArray::Destroy(); }
		virtual bool				IsValid()	const	{ return _uID != 0; }
		virtual e_resource::type	GetType()	const	{ return e_resource::TEXTURE_2D_ARRAY; }
	};



	//
	// Texture Cube
	//

	class _EXPORT_ CTextureCube : public GLTextureCube, public CResource
	{
	public:
		virtual bool				SwapData(const IResourcePtr &);
		virtual void				Destroy()			{ return GLTextureCube::Destroy(); }
		virtual bool				IsValid()	const	{ return _uID != 0; }
		virtual e_resource::type	GetType()	const	{ return e_resource::TEXTURE_CUBE_MAP; }
	};



	//
	// Texture Cube Array
	//

	class _EXPORT_ CTextureCubeArray : public GLTextureCubeArray, public CResource
	{
	public:
		virtual bool				SwapData(const IResourcePtr &);
		virtual void				Destroy()			{ return GLTextureCubeArray::Destroy(); }
		virtual bool				IsValid()	const	{ return _uID != 0; }
		virtual e_resource::type	GetType()	const	{ return e_resource::TEXTURE_CUBE_MAP_ARRAY; }
	};



	//
	// Texture 3D
	//

	class _EXPORT_ CTexture3D : public GLTexture3D, public CResource
	{
	public:
		virtual bool				SwapData(const IResourcePtr &);
		virtual void				Destroy()			{ return GLTexture3D::Destroy(); }
		virtual bool				IsValid()	const	{ return _uID != 0; }
		virtual e_resource::type	GetType()	const	{ return e_resource::TEXTURE_3D; }
	};



	//
	// Texture 2D Multisample
	//

	class _EXPORT_ CTexture2DMS : public GLTexture2DMS, public CResource
	{
	public:
		virtual bool				SwapData(const IResourcePtr &);
		virtual void				Destroy()			{ return GLTexture2DMS::Destroy(); }
		virtual bool				IsValid()	const	{ return _uID != 0; }
		virtual e_resource::type	GetType()	const	{ return e_resource::TEXTURE_2D_MS; }
	};



	//
	// Texture 2D Multisample Array
	//

	class _EXPORT_ CTexture2DMSArray : public GLTexture2DMSArray, public CResource
	{
	public:
		virtual bool				SwapData(const IResourcePtr &);
		virtual void				Destroy()			{ return GLTexture2DMSArray::Destroy(); }
		virtual bool				IsValid()	const	{ return _uID != 0; }
		virtual e_resource::type	GetType()	const	{ return e_resource::TEXTURE_2D_MS_ARRAY; }
	};



	//
	// Texture Buffer
	//

	class _EXPORT_ CTextureBuffer : public GLTextureBuffer, public CResource
	{
	private:
		void _SwapData(gl_tex_iformat::type &eIFormat, GLuint &uTexID,
						gl_buffer::type &eTarget, GLuint &uBufID, usize &uSize);

	public:
		virtual bool				SwapData(const IResourcePtr &);
		virtual void				Destroy()			{ return GLTextureBuffer::Destroy(); }
		virtual bool				IsValid()	const	{ return GLTexture::_uID != 0 && GLBuffer::_uID != 0; }
		virtual e_resource::type	GetType()	const	{ return e_resource::TEXTURE_BUFFER; }
	};
	
//-------------------------------------------------------------------

}	// Resources
}	// Engine

#endif	// _UX_TEXTURES_H